<!-- 本页样式 -->
<style scoped lang="scss">
.del-dialog-cnt {
  font-size: 16px;
  text-align: center;
}
</style>
<style lang="scss">
.applybatch_list{
  .transform{
    .el-icon-sort{
      transform: rotate(90deg) !important;
    }
  }
}
.applybatch-list-popover{
    // background: rgb(243, 243, 243) !important;
    // border-color: #c6e2ff !important;
    // background-color: #ecf5ff;
    .popper__arrow::after{
      // border-left-color: rgb(243, 243, 243) !important;
      border-left-color: #00978A !important;
      // border-left-color: #c6e2ff !important;
      // background-color: #ecf5ff;
    }
}
.delconfirm{
    border: solid 1px #DB2828;
    line-height: 30px;
    border-radius: 2px;
    background-color: #FFE8E6;
    color: #DB2828;
    margin: 1em 0em;
    padding: 5px 10px;
}
.delconfirminput{
  .el-input__inner{
    background: #fff0f0;
    border-color: #dbb1b1;
    color: #d95c5c;
    border-radius: 2px;
  }
}
.deldialog{
  .el-dialog__body{
    padding: 0px 20px 10px;
  }
}
</style>
<!-- 页面布局-->
<template>
  <div class="table applybatch_list">
    <!-- 标题导航栏 -->
    <div class="title-box crumbs">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>
          <i class="el-icon-tickets"></i>制卡管理
        </el-breadcrumb-item>
        <el-breadcrumb-item>人联网制卡申请</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <!-- 主体区 -->
    <div class="container">
      <!-- 查询条件 -->
      <div class="search-box fxcol">
        <div class="fxrow">
          <div class="search-item-box" style="margin-bottom: 10px;">
            <table>
              <tr>
                <td>
                  <i class="el-icon-search"></i>
                </td>
                <td class="search_td">
                  <el-select v-model="parampters.dataFormatNo" clearable placeholder="卡数据格式" style="width: 120px !important;">
                    <el-option v-for="item in dicts.dataformatNo" :key="item.code" :label="item.name" :value="item.code">
                    </el-option>
                  </el-select>
                </td>
                <td class="search_td">
                  <el-date-picker v-model="parampters.year" type="year" placeholder="申请年份" value-format="yyyy" style="width:120px;"></el-date-picker>
                </td>
                <td class="search_td">
                  <el-input v-model="parampters.applyBatchNo" clearable placeholder="申请批次" class="handle-input mr10" style="width:150px;"></el-input>
                </td>
                <td class="search_td" style="width: 180px;">
                  <el-select v-model="parampters.status" clearable placeholder="状态">
                    <el-option v-for="item in dicts.cardapply" :key="item.code" :label="item.name" :value="item.code">
                    </el-option>
                  </el-select>
                </td>
                <td class="search_td">
                  <el-date-picker v-model="parampters.starttime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="起始时间" class="handle-input mr10" style="width:190px;">
                  </el-date-picker>
                </td>
                <td class="search_td">
                  <el-date-picker v-model="parampters.endtime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="截止时间" class="handle-input mr10" style="width:190px;">
                  </el-date-picker>
                </td>
              </tr>
            </table>
          </div>
        </div>
        <div class="search-button-box">
          <el-button type="primary" size="small" icon="search" @click="searchLoad">查询</el-button>
          <el-button type icon="el-icon-circle-plus" size="small" @click="preApply('file')">文件申请</el-button>
          <el-button type icon="el-icon-circle-plus" size="small" @click="preApply('batch')">成卡申请</el-button>
          <el-button type icon="el-icon-circle-plus" size="small" @click="preApply('white')">白卡申请</el-button>
          <el-button type size="small" @click="download2analysNow()">立即下载联通VOP文件</el-button>
					<!-- <el-button type size="small" icon="el-icon-download" @click="toExportApplyBatch">导出 Excel</el-button> -->
        </div>
      </div>
      <!-- 查询条件END -->
      <!-- 数据列表 -->
      <div class="grid-data-box">
        <el-table v-loading="tableLoading" :max-height="tableListHeight - 47" :data="tableData" border :cell-class-name="changeColumnClass" :header-cell-style="{background:'#F3F3F3',color:'#606266'}" show-overflow-tooltip style="width: 100%" ref="multipleTable" @row-dblclick="clickToView">
          <el-table-column type="index" label="序号" width="50" show-overflow-tooltip></el-table-column>
          <el-table-column prop="dataformatNo" label="卡数据格式" width="100" :formatter="formatter" show-overflow-tooltip></el-table-column>
          <el-table-column prop="year" label="年份" width="70" show-overflow-tooltip align="center"></el-table-column>
          <el-table-column prop="applyBatchNo" label="申请批次" show-overflow-tooltip></el-table-column>
          <el-table-column prop="cardNum" label="申请数量" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column prop="status" label="状态" :formatter="formatter" show-overflow-tooltip></el-table-column>
          <el-table-column prop="timestamp" label="操作时间" width="200" show-overflow-tooltip></el-table-column>
          <el-table-column label="操作" fixed="right" width="150">
            <template slot-scope="scope">
              <el-popover placement="left" width="180" trigger="hover" popper-class="applybatch-list-popover" @show="getRightButton(scope.row)">
                <div class="fxcol fxcc" style="margin: 10px 0;">
                  <el-button size="mini" v-for="item in rightButton" :key="item.ms_resource_id" :type="item.type" @click="handleClickMore(scope.row,item.method)" :style="{width: '135px',margin: item.ms_resource_id != '1' ? '10px 0 0 0' : ''}" >{{item.name}}</el-button>
                </div>
                <span slot="reference" style="cursor:pointer">更多</span>
              </el-popover>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <!-- 数据列表END -->
      <!-- 翻页导航条 -->
      <div class="navigate-box">
        <div class="pagination">
          <el-pagination background @current-change="handleCurrentChange" :total="parampters.totalCount" @size-change="handleSizeChange" :current-page.sync="parampters.pageIndex" :page-sizes="[20, 50, 100, 200]" :page-size="parampters.pageRows" layout="total, sizes, prev, pager, next"></el-pagination>
        </div>
      </div>
      <!-- 翻页导航条END -->
    </div>
    <!-- 主体区END -->
    <el-dialog title="开始生成制卡申请文件，并提交联通" :visible.sync="dialogVisible" width="30%" :show-close="false" :close-on-click-modal="false">
      <span>{{this.dialog_time}}s 后将自动查询并更新申请单状态</span>
    </el-dialog>
    <el-dialog title="作废批次" :visible.sync="delDialogVisible" width="30%" :show-close="false" :close-on-click-modal="false" custom-class="deldialog">
      <div class="delconfirm" style="font-weight: bold;">警告：将作废本申请批次</div>
      <div class="delconfirm">为防止意外，确认继续操作请输入以下内容：</div>
      <div class="delconfirm" style="font-weight: bold;color: black;"><span style="border-bottom: 2px dashed red;">{{ delApplyBatchNo }}</span></div>
      <div>
        <el-input v-model="confirmDelApplyBatchNo" clearable placeholder="请输入提示内容以确认继续操作" class="delconfirminput"></el-input>
      </div>
      <div v-show="showDeltips" style="color: red;">批次号错误</div>
      <div class="box-bottom" style="margin-top: 20px;">
        <el-button type="primary" style="margin-right: 36px;" @click="toDel" :disabled="disableDelBtn">确 定</el-button>
        <el-button @click="delDialogVisible = false">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>


<script>
import applybatchupd from "./applybatch_upd";
import fileapply from "./applybatch_fileapply";
import batchapply from "./applybatch_batchapply";
import apply from "./applybatch_apply";
import formatfile from "./formatfile";
import applyrecord from "./applybatch_history";
import downloadfilelist from "./applybatch_downloadfilelist";
import deldeal from './applybatch_del_deal'
export default {
  data() {
    return {
      // 筛选条件
      parampters: {
        //查询参数
        loginsid: "", //登录会话SID
        pageRows: 20, //每页行数
        pageIndex: 1, //当前页
        pageCount: 0, //总页数
        totalCount: 0, //总记录数
        dataFormatNo: "", //卡数据格式
        year: "", //申请年份
        applyBatchNo: "", //申请批次
        status: "", //状态
        starttime: "", //起始时间
        endtime: "", //截止时间
      },
      // 查询出的表格数据
      tableLoading: true,
      tableData: [],
      //confirm提示信息弹框
      confirmBox: null,
      //所选记录id
      selectedId: "",
      //事物类型
      actType: "list",
      //字典集
      dicts: {},
      dialogVisible: false,
      dialog_time: 5,
      dialogTimer: null,
      delDialogVisible: false,
      delApplyBatchNo: "",
      confirmDelApplyBatchNo: "",
      showDeltips: false,
      allStatusButton:[],
      allRightButton: [
        {
          id: 1,
          tag: "cardApplyBatch_button_commit",
          name: "提交",
          method: "toReApply",
          type: "primary"
        },
        {
          id: 2,
          tag: "cardApplyBatch_button_update",
          name: "修改",
          method: "toUpd",
          type: "primary"
        },
        {
          id: 3,
          tag: "cardApplyBatch_button_exportDetail",
          name: "导出明细 Excel",
          method: "toExportExcel",
          type: "primary"
        },
        {
          id: 4,
          tag: "cardApplyBatch_button_getFiles",
          name: "可下载文件列表",
          method: "toDownloadFileList",
          type: "primary"
        },
        {
          id: 5,
          tag: "cardApplyBatch_button_getLogs",
          name: "申请日志列表",
          method: "toApplyRecord",
          type: "primary"
        },
        {
          id: 6,
          tag: "cardApplyBatch_button_divide",
          name: "制卡数据转换",
          method: "transformFile",
          type: "primary"
        },
        {
          id: 7,
          tag: "cardApplyBatch_button_delete",
          name: "作废",
          method: "preDel",
          type: "danger"
        },
        {
          id: 8,
          tag: "cardApplyBatch_button_doDelete",
          name: "作废申请处理",
          method: "toDelDeal",
          type: "primary"
        }
      ],
      rightButton:[],
    };
  },
  computed:{
    disableDelBtn: function() {
      if(this.confirmDelApplyBatchNo == "" || this.confirmDelApplyBatchNo == undefined || this.confirmDelApplyBatchNo == null) return true;
      else return false;
    }
  },
  // 进入页面加载数据
  activated() {
		this.$set(this.parampters, "dataFormatNo", "");
		this.$set(this.parampters, "year", "");
		this.$set(this.parampters, "applyBatchNo", "");
		this.$set(this.parampters, "status", "");
		this.$set(this.parampters, "starttime", "");
		this.$set(this.parampters, "endtime", "");
    this.handleInitLoad();
  },
  methods: {
    /**
     * 组件初始化加载
     */
    handleInitLoad() {
      this.initSelectOptoins();
      this.getStatusAllButton();
      this.searchLoad();
    },

    /**
     * 初始加载字典选项
     */
    initSelectOptoins() {
      this.loadSelectOptoins("cardapply", null);
      this.loadSelectOptoins("dataformatNo", null);
    },

    /**
     * 通用定义:下拉字典
     *  @augments dictKind 字典类型
     */
    loadSelectOptoins(dictKind, params) {
      let url = "/rps/dictionary/";
      this.$axios
      .get(url, {
        params: {
          type: dictKind
        },
        headers:{
          operator: this.$util.getLoginer().userid,
          withCredentials: true
        }
      })
      .then(res => {
        let data = res.data;
        if (data.success) {
          this.$set(this.dicts, dictKind, data.data.list);
        } else {
          this.$error( data.message );
        }
      })
      .catch(err => {
        console.log(err);
      });
    },
    
    changeColumnClass(data) {
      return "";
      // if (data.columnIndex == 1 || data.columnIndex == 2) {
      //   return "tabcolumn_left";
      // }
    },

    /**
     * @augments  row 行所在的数据
     * 表格数据列 内容字典转换
     */
    formatter(row, column) {
      if (column.property == "dataformatNo") {
        return this.$dicts.transDict( this.dicts.dataformatNo, "code", "name", row.dataformatNo);
      } else if (column.property == "status") {
        return this.$dicts.transDict( this.dicts.cardapply, "code", "name", row.status);
      }else if(column.property == "timestamp"){
        if(row.timestamp == undefined || row.timestamp == null || row.timestamp == ""){
          return "";
        }else{
          let now = new Date(Number(row.timestamp));
          let y = now.getFullYear();
          let m = now.getMonth() + 1;
          let d = now.getDate();
          return y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d) + " " + now.toTimeString().substr(0, 8);
        }
      }
    },

    /**
     * @augments val 页码
     * 切换页码操作
     */
    handleCurrentChange(val) {
      this.parampters.pageIndex = val;
      // 重新获取当前页码的数据
      this.searchLoad();
    },

    /**
     * @augments val 每页显示条数
     * 每页显示条数修改
     */
    handleSizeChange(val) {
      // 修改每页显示条数
      this.parampters.pageRows = val;
      // 重新获取数据
      this.searchLoad();
    },
    /**
     * 获取所有状态值的可操作按钮列表
     */
    getStatusAllButton(){
        this.$axios.get("/rps/cardApplyBatch/button/?"+new Date().getTime(),{
            headers: {
              operator: this.$util.getLoginer().userid,
              withCredentials: true
            }
        }).then(res => {
            let data = res.data;
            if(data.success){
                this.allStatusButton = data.data;
            }else{
               this.$error(data.message); 
            }
        }).catch(err => {
            console.log(err);
        })
    },

    /**
     * 条件筛选查询,加载数据
     */
    searchLoad() {
      this.parampters = this.$util.trimObjStr(this.parampters);
      this.parampters.loginsid = this.$util.getLoginer().sessionId;
      this.tableLoading = true;
      this.$axios
        .get(
          "/rps/cardApplyBatch/?"+new Date().getTime(),
          {
            params: this.parampters,
            headers: {
              operator: this.$util.getLoginer().userid,
              withCredentials: true
            }
          }
        )
        .then(res => {
          let data = res.data;
          if (data.success) {
            this.tableData = data.data.list;
            this.tableLoading = false;
            this.parampters.pageIndex =
              data.data.pageNum != undefined ? parseInt(data.data.pageNum) : 0;
            this.parampters.pageCount =
              data.data.totalPage != undefined ? parseInt(data.data.totalPage) : 0;
            this.parampters.totalCount =
              data.data.count != undefined ? parseInt(data.data.count) : 0;
          } else {
            this.tableLoading = false;
            this.$error(data.message);
          }
        })
        .catch(err => {
          this.tableLoading = false;
          console.log(err);
        });
    },

    /**
     * 获取右侧可点击按钮
     */
    getRightButton(row){
      let rightbtn = this.allStatusButton[row.status];
        this.rightButton = [];
        this.allRightButton.forEach(button=>{
            rightbtn.forEach( item => {
                if(button.tag == item.tag){
                    this.rightButton.push(button)
                }
            });
        });
    },

    /**
     * 点击右侧按钮
     */
    handleClickMore(row, method){
      this[method](row)
    },

    /**
     * 校验当前是否有未通过的制卡申请单
     */
    preApply(flag){
      // this.$axios
      //   .get("/rps/cardApplyBatchs/unConfirmed/", {
      //     headers: {
      //       operator: this.$util.getLoginer().userid,
      //       withCredentials: true
      //     }
      //   })
      //   .then(res => {
      //     let data = res.data;
      //     if (data.success) {
            switch(flag){
              case 'file': this.toFileApply(); return;
              case 'batch': this.toBatchApply(); return;
              case 'white': this.toApply(); return;
            }
        //   } else {
        //     this.$error(data.message);
        //   }
        // })
        // .catch(err => {
        //   console.log(err);
        // });
    },

    /**
     * 文件申请
     */
    toFileApply() {
      //页面参数
      var pageParam = {
        loginInfo: this.$util.getLoginer(),
        actType: "add",
        seleid: "-1"
      };
      let commDialog = this.$dialog.commDialog(
        "文件导入",
        fileapply,
        pageParam,
        "900px",
        "530px"
      );
      commDialog.exec.then(data => {
        this.searchLoad();
      });
    },

    /**
     * 成卡申请
     */
    toBatchApply() {
      //页面参数
      var pageParam = {
        loginInfo: this.$util.getLoginer(),
        actType: "add",
      };
      let commDialog = this.$dialog.commDialog(
        "按号段录入申请",
        batchapply,
        pageParam,
        "900px",
        "530px"
      );
      commDialog.exec.then(data => {
        this.searchLoad();
      });
    },

    /**
     * 白卡申请
     */
    toApply() {
      //页面参数
      var pageParam = {
        loginInfo: this.$util.getLoginer(),
        actType: "add",
        seleid: "-1"
      };
      let commDialog = this.$dialog.commDialog(
        "联通白卡申请",
        apply,
        pageParam,
        "700px",
        "440px"
      );
      commDialog.exec.then(data => {
        this.searchLoad();
      });
    },

    /**
     * 重新申请
     */
    toReApply( row ) {
      this.confirmBox = this.$dialog.confirm("确定要提交所选制卡申请记录吗？");
      this.confirmBox.exec.then(btnName => {
        if (btnName == "ok") {
          this.$util.loadingshow();
          let url = "/rps/cardApplyBatch/"+ row.cardApplyBatchId +"/";
          this.$axios.post(url, {}).then(res => {
            this.$util.loadinghide();
            let data = res.data;
            if( data.success ){
              this.$dialog.close(this.confirmBox.vm);
              this.dialogVisible = true;
              this.dialog_time = 5;
              this.dialogTimer = setInterval(()=>{
                 this.dialog_time --;
                 if( this.dialog_time == 0 ){
                   clearInterval(this.dialogTimer);
                   this.dialogVisible = false;
                   this.searchLoad();
                 }
              }, 1000);
            } else {
              this.$dialog.close(this.confirmBox.vm);
              this.$error( data.message );
            }
          }).catch(err => {
            this.$dialog.close(this.confirmBox.vm);
            this.$util.loadinghide();
            console.log( err );
          });
        } else {
          this.$dialog.close(this.confirmBox.vm);
        }
      })
    },

    /**
     * 修改记录信息
     * @augments index 编辑数据所在的行索引
     * @augments row 编辑数据行的数据
     */
    toUpd(row) {
      if(row.dataformatNo == "01"){
        this.$error("白卡申请不支持修改");
        return;
      }
      this.selectedId = row.cardApplyBatchId;
      //页面参数
      var pageParam = {
        actType: "upd",
        seleid: this.selectedId
      };
      let commDialog = this.$dialog.commDialog(
        "编辑联通制卡申请信息",
        applybatchupd,
        pageParam,
        "900px",
        "540px"
      );
      commDialog.exec.then(resp => {
        if (resp.type == "ok") {
          this.searchLoad();
        } else if (resp.type == "cancel") {
        }
      });
    },

    /**
     * 导出 excel
     */
    toExportExcel( row ) {
      let cardApplyBatchId = row.cardApplyBatchId;
      this.$axios
        .get("/rps/cardApplyDetail/"+ cardApplyBatchId +"/export/", {
          headers: {
            operator: this.$util.getLoginer().userid,
            withCredentials: true
          }
        })
        .then(res => {
          let data = res.data;
          // 关闭提交表单的loading
          if (data.success) {
            let downloadUrl = data.data;
            let n = downloadUrl.split("/");
            var link = document.createElement('a');
            //设置下载的文件名
            link.download = n[ n.length-1 ];
            link.style.display = 'none';
            //设置下载路径
            link.href = downloadUrl;
            //浏览器兼容，禁止打开新的页面
            link.target = "_self";
            //触发点击
            document.body.appendChild(link);
            link.click();
            //移除节点
            document.body.removeChild(link);
          } else {
            this.$error(data.message);
          }
        })
        .catch(err => {
          console.log(err);
        });
    },

    //
    clickToView(rowData, column, event) {
      this.toView(rowData);
    },

    /**
     * 查看记录信息
     * @augments row 编辑数据行的数据
     * @augments ev
     */
    toView(row) {
      this.selectedId = row.cardApplyBatchId;
      if(row.dataformatNo == "02"){
        //页面参数
        let pageParam = {
          actType: "view",
          seleid: this.selectedId
        };
        let commDialog = this.$dialog.commDialog(
          "查看联通制卡申请信息",
          applybatchupd,
          pageParam,
          "900px",
          "540px"
        );
        commDialog.exec.then(data => {});
      }else{
        //页面参数
        let pageParam = {
          actType: "view",
          seleid: this.selectedId
        };
        let commDialog = this.$dialog.commDialog(
          "查看联通制卡申请信息",
          apply,
          pageParam,
          "700px",
          "440px"
        );
        commDialog.exec.then(data => {});
      }
    },

    preDel(row){
      this.selectedId = row.cardApplyBatchId;
      this.delApplyBatchNo = row.applyBatchNo;
      this.delDialogVisible = true;
      this.confirmDelApplyBatchNo = "";
    },

    /**
     * 删除记录信息
     * @augments index 所在表格行的索引
     * @augments row 所在表格行的所有数据对象
     */
    toDel() {
      if(this.confirmDelApplyBatchNo.trim() != this.delApplyBatchNo){
        this.showDeltips = true;
        return;
      }else{
        this.showDeltips = false;
      }
      this.$axios
        .delete(
          "/rps/cardApplyBatch/" + this.selectedId + "/",
          { 
            loginsid: this.$util.getLoginer().sessionId,
            userid: this.selectedId
          },
          {
            headers: {
              operator: this.$util.getLoginer().userid,
              withCredentials: true
            }
          }
        )
        .then(res => {
          let data = res.data;
          if (data.success) {
            let url = data.data;
            if(url != null && url != undefined && url != ""){
              this.$alert("需要到联通方继续申请作废，点击确定后将于新页面打开联通方网站", "", {
                confirmButtonText: '去往联通',
                closeOnClickModal: false,
                showClose: false
              }).then(confirm => {
                this.delDialogVisible = false;
                this.searchLoad();
                let n = url.split("/");
                var link = document.createElement('a');
                link.style.display = 'none';
                //设置下载路径
                link.href = url;
                //浏览器兼容，禁止打开新的页面
                link.target = "_blank";
                //触发点击
                document.body.appendChild(link);
                link.click();
                //移除节点
                document.body.removeChild(link);
              }, cancel => {
                this.delDialogVisible = false;
                console.log(cancel);
              })
            } else {
              this.$message.success("作废申请已提交");
              this.delDialogVisible = false;
              this.searchLoad();
            }
          } else {
            this.$error(data.message);
          }
        })
        .catch(err => {
          console.log(err);
        });
   
    },
    
    transformFile(row){
      this.selectedId = row.cardApplyBatchId;
      //页面参数
      var pageParam = {
        seleid: this.selectedId
      };
      let commDialog = this.$dialog.commDialog(
        "制卡数据转换",
        formatfile,
        pageParam,
        "900px",
        "410px"
      );
      commDialog.exec.then(resp => {
        if (resp.type == "ok") {
        } else if (resp.type == "cancel") {
        }
      });
    },

    ifDel(status){
      status = Number(status);
      if(status != 1 && status != 2 && status != 4 && status != 6 && status != 9){
        return true;
      }else{
        return false;
      }
    },

    /**
     * 立即下载并解析
     */
    download2analysNow(){
      this.$axios.post('/rps/downloadScheduleFiles/?' + new Date(), {}).then(res => {
        this.$message.success("请求成功，将于后台服务器自动下载所有文件并解析");
      }).catch(err => {
        console.log(err);
      });
    },
    
    /**
     * 作废申请处理
     */
    toDelDeal(row){
      this.selectedId = row.cardApplyBatchId;
      //页面参数
      var pageParam = {
        seleid: this.selectedId,
        delApplyBatchNo: row.applyBatchNo
      };
      let commDialog = this.$dialog.commDialog(
        "作废申请处理",
        deldeal,
        pageParam,
        "700px",
        "400px"
      );
      commDialog.exec.then(resp => {
        if (resp.type == "ok") {
          this.searchLoad();
        } else if (resp.type == "cancel") {
        }
      });
    },

    /**
     * 可下载文件列表
     */
    toDownloadFileList(row){
      this.selectedId = row.cardApplyBatchId;
      //页面参数
      var pageParam = {
        seleid: this.selectedId
      };
      let commDialog = this.$dialog.commDialog(
        "查看可下载文件列表",
        downloadfilelist,
        pageParam,
        "900px",
        "540px"
      );
      commDialog.exec.then(resp => {
        if (resp.type == "ok") {
        } else if (resp.type == "cancel") {
        }
      });
    },

    /**
     * 查看申请操作日志
     */
    toApplyRecord(row){
      this.selectedId = row.cardApplyBatchId;
      //页面参数
      var pageParam = {
        seleid: this.selectedId
      };
      let commDialog = this.$dialog.commDialog(
        "查看申请操作日志",
        applyrecord,
        pageParam,
        "900px",
        "540px"
      );
      commDialog.exec.then(resp => {
        if (resp.type == "ok") {
        } else if (resp.type == "cancel") {
        }
      });
    },

    toExportApplyBatch(){
      this.$axios
				.get("/rps/cardApplyBatch/export/", {
					params: this.parampters,
					headers: {
						operator: this.$util.getLoginer().userid,
						withCredentials: true
					}
				})
				.then(res => {
					let data = res.data;
					// 关闭提交表单的loading
					if (data.success) {
						let downloadUrl = data.data;
						let n = downloadUrl.split("/");
						var link = document.createElement('a');
						//设置下载的文件名
						link.download = n[ n.length-1 ];
						link.style.display = 'none';
						//设置下载路径
						link.href = downloadUrl;
						//浏览器兼容，禁止打开新的页面
						link.target = "_self";
						//触发点击
						document.body.appendChild(link);
						link.click();
						//移除节点
						document.body.removeChild(link);
					} else {
						this.$error(data.message);
					}
				})
				.catch(err => {
					console.log(err);
				});
    }


  },
};
</script>
